package com.lzw.breezeNovel.webApp.mapper.Ai;

import com.lzw.breezeNovel.model.entity.pojo.Ai.AiAnswer;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.mapper
 * @date 2025/3/20
 * @description
 */
@Mapper
@SuppressWarnings("all")
public interface AiAnswerMapper {

    /**
     * 根据id查询答案
     * @param id
     * @return
     */
    @Select("select ai_content,user_content from ai_answer where id = #{id} and DATE(create_time) = CURRENT_DATE ")
    List<AiAnswer> getAiAnswer(Long id);

    /**
     * 保存用户的对话历史记录
     * @param aiAnswer
     */
    @Insert("insert into ai_answer(ai_content,user_content,user_id,create_time) values(#{aiContent},#{userContent},#{userId},now())")
    void insert(AiAnswer aiAnswer);
}
